package com.jasmine.auth;

import com.jasmine.auth.controller.ControllerConfig;
import com.jasmine.auth.interceptor.AuthInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

import javax.annotation.PostConstruct;

/**
 * @author jasmineXz
 */
@Import({
    AuthMvcConfig.class,   // mvc配置
    ControllerConfig.class // controller配置
})
public class AuthConfig {
    private static final Logger log = LoggerFactory.getLogger(AuthConfig.class);

    @Bean
    public AuthInterceptor authInterceptor () {
        return new AuthInterceptor();
    }

    @Bean
    public TokenManager tokenManager () {
        return new TokenManager();
    }

    @PostConstruct
    public void init() {
        log.info("[BJSTK] [AUTH] AuthConfig Initialization completed");
    }

}
